package com.xingren.wms.api.config;

import com.xingren.spring.format.CustomFormatterRegistrar;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.web.config.EnableSpringDataWebSupport;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import static com.xingren.wms.model.ModelConstants.ENUM_PROP_NAME;

@Configuration
@EnableSpringDataWebSupport
public class WebConfig extends WebMvcConfigurerAdapter {

    /**
     * 添加值转换器
     */
    @Override
    public void addFormatters(FormatterRegistry registry) {
        new CustomFormatterRegistrar(ENUM_PROP_NAME).registerFormatters(registry);
    }
}
